package entities;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

@Entity
@Table(uniqueConstraints = { @UniqueConstraint(columnNames = "userName") })
public class Intern implements Serializable {

	private Long internId;
	private String name;
	private String surname;
	private String email;
	private String university;
	private String department;
	private String telephone;
	private List<ProgLanguage> languageList;
	private Float agno;
	private String userName;
	private String password;
	private String role;

	private static final long serialVersionUID = -9009585682938019902L;

	/**
	 * Stajyer ozgecmisine bir programlama dili ekler..
	 */
	public void addProgLanguage(ProgLanguage language) {
		if (languageList == null) {
			setLanguageList(new ArrayList<ProgLanguage>());
		}
		languageList.add(language);
	}

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	public Long getInternId() {
		return internId;
	}

	public void setInternId(Long internId) {
		this.internId = internId;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getSurname() {
		return surname;
	}

	public void setSurname(String surname) {
		this.surname = surname;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getUniversity() {
		return university;
	}

	public void setUniversity(String university) {
		this.university = university;
	}

	public String getDepartment() {
		return department;
	}

	public void setDepartment(String department) {
		this.department = department;
	}

	public Float getAgno() {
		return agno;
	}

	public void setAgno(Float agno) {
		this.agno = agno;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getRole() {
		return role;
	}

	public void setRole(String role) {
		this.role = role;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getTelephone() {
		return telephone;
	}

	public void setTelephone(String telephone) {
		this.telephone = telephone;
	}

	@OneToMany(mappedBy = "intern", cascade = CascadeType.ALL)
	public List<ProgLanguage> getLanguageList() {
		return languageList;
	}

	public void setLanguageList(List<ProgLanguage> languageList) {
		this.languageList = languageList;
	}

}
